<div class="row">
  <div class="col-md-12">
    <div class="admin-header">
      <div class="row">
        <div class="col-md-4 admin-title">
          <h2>{{class2show}}
            <a href="{{ database.getWiki() }}" target="_blank" class="btn btn-trasparent btn-help"
               data-placement="right"
               data-title="Help"
               data-trigger="hover"
               data-animation="am-flip-x"
               bs-tooltip>
              <i class="fa fa-question-circle fa-lg"></i>
            </a>
          </h2>
        </div>
        <div class="col-md-8 admin-actions">

          <div class="btn-toolbar pull-right">
            <div class="btn-group">
              <button href="javascript:void(0)" class="btn btn-sm btn-primary" ng-click="saveProperty(property)">
                <i
                  class="fa fa-save"></i> Save
              </button>

            </div>

            <div class="btn-group">
              <button href="javascript:void(0)" class="btn btn-default btn-sm" ng-click="queryAll(class2show)"><i
                class="fa fa-list-alt"></i>
                Query All
              </button>
            </div>
            <div class="btn-group">
              <button href="javascript:void(0)" class="btn btn-default btn-sm"
                      ng-click="createNewRecord(class2show)">
                <i
                  class="fa fa-plus"></i>
                New Record
              </button>

            </div>
            <div class="btn-group">
              <button href="javascript:void(0)" class="btn btn-sm btn-danger"
                      ng-disabled="!canDrop(class2show)"
                      ng-click="dropClass(class2show)"><i
                class="fa fa-trash-o"></i>
                Drop
              </button>
            </div>

          </div>
        </div>
      </div>
    </div>

    <div class="card">
      <div class="row properties">
        <div class="col-md-12">
          <div class="page-header">
            <h4>Properties
              <a href="javascript:void(0)" tabindex="1"
                 data-trigger="focus" data-placement="right"
                 data-container="body"
                 data-content="{{ 'class.property' | translate:links }}" bs-popover>
                <i class="fa fa-question-circle"></i>
              </a>
            </h4>
          </div>
        </div>
        <div class="col-md-12">
          <div class="btn-group pull-right">
            <button href="javascript:void(0)" class="btn  btn-default btn-sm" ng-click="newProperty()"><i
              class="fa fa-plus"></i> New
              Property
            </button>
          </div>
        </div>
        <div class="col-md-12">
          <div class="scroll-editclass">
            <table class="table table-striped table-bordered table-hover table-condensed pointer"
                   ng-show="classClickedHeaders">
              <thead>
              <tr>
                <th ng-repeat="header in classClickedHeaders">
                  {{header}}
                </th>
              </tr>

              </thead>
              <tbody>
              <tr ng-repeat="result in property |  orderBy:'name'">
                <td>
                  {{result['name']}}</a>
                </td>
                <td>
                  <select ng-model="result['type']" ng-options="p.toString() for p in listTypes"
                          ng-change="modificato(result,'type')">

                  </select>
                  <!-- <input type="text" ng-model="result['type']" ng-change="modificato(result,'type')"> -->
                </td>
                <td>
                  <select ng-model="result['linkedType']" ng-options="p.toString() for p in listTypes"
                          ng-change="modificato(result,'linkedType')" ng-disabled="checkTypeEdit(result)">
                    <option value=""></option>
                  </select>

                </td>

                <td>
                  <select ng-model="result['linkedClass']" ng-options="p.toString() for p in listClasses"
                          ng-change="modificato(result,'linkedClass')"
                          ng-disabled="checkClassEdit(result)">
                    <option value=""></option>
                  </select>

                <td>
                  <input type="checkbox" ng-model="result['mandatory']"
                         ng-change="modificato(result,'mandatory')">
                </td>
                <td>
                  <input type="checkbox" ng-model="result['readonly']"
                         ng-change="modificato(result,'readonly')">
                </td>
                <td>
                  <input type="checkbox" ng-model="result['notNull']"
                         ng-change="modificato(result,'notNull')">
                </td>
                <td>
                  <input type="text" ng-model="result['min']" ng-change="modificato(result,'min')"
                         ng-show="result['type'] != 'DATE' && result['type'] != 'DATETIME'">
                  <input type="text" bs-datepicker ng-model="result['min']"
                         ng-change="modificato(result,'min')" orientdate
                         ng-show="result['type'] == 'DATE'">


                  <input type="text" bs-datepicker ng-model="result['min']"
                         ng-change="modificato(result,'min')" orientdatetime
                         ng-show="result['type'] == 'DATETIME'">

                  <input type="text" bs-timepicker ng-model="result['min']"
                         ng-change="modificato(result,'min')" orientdatetime
                         ng-show="result['type'] == 'DATETIME'">

                </td>
                <td>
                  <input type="text" ng-model="result['max']" ng-change="modificato(result,'max')"
                         ng-show="result['type'] != 'DATE' && result['type'] != 'DATETIME'">
                  <input type="text" bs-datepicker ng-model="result['max']"
                         ng-change="modificato(result,'max')" orientdate
                         ng-show="result['type'] == 'DATE'">

                  <input type="text" bs-datepicker ng-model="result['max']"
                         ng-change="modificato(result,'max')" orientdatetime
                         ng-show="result['type'] == 'DATETIME'">

                  <input type="text" bs-timepicker ng-model="result['max']"
                         ng-change="modificato(result,'max')" orientdatetime
                         ng-show="result['type'] == 'DATETIME'">
                </td>
                <td>
                  <select ng-model="result['collate']" ng-options="p.toString() for p in collateTypes"
                          collaterender ng-change="modificato(result,'collate')"
                          ng-disabled="result['type'] != 'STRING'">
                  </select>

                </td>
                <td>
                  <div class="btn-group">
                    <button href="javascript:void(0)" class="btn btn-primary btn-xs"
                            ng-click="rename(result)">
                      Rename
                    </button>
                  </div>
                  <div class="btn-group">
                    <button href="javascript:void(0)" class="btn btn-danger btn-xs"
                            ng-click="dropProperty(result,result['name'])"><i
                      class="fa fa-trash-o"></i>
                      Drop
                    </button>
                  </div>
                </td>
              </tr>
              </tbody>

            </table>
          </div>
        </div>
      </div>

      <div class="row">
        <div class="col-md-12">
          <div class="page-header">
            <h4 >Indexes
              <a href="javascript:void(0)" tabindex="1"
                 data-trigger="focus" data-placement="right"
                 data-container="body"
                 data-content="{{ 'class.indexes' | translate:links }}" bs-popover>
                <i class="fa fa-question-circle"></i>
              </a>
            </h4>

          </div>
        </div>
        <div class="col-md-12">
          <div class="btn-group pull-right">
            <button href="javascript:void(0)" class="btn btn-sm btn-default" ng-click="newIndex()"><i
              class="fa fa-plus"></i> New Index
            </button>
          </div>
        </div>
        <div class="col-md-12">
          <div class="scroll-indexes">
            <table class="table table-striped table-bordered table-hover table-condensed pointer"
                   ng-show="classClickedHeaders">
              <thead>
              <tr>

                <th>
                  Name
                </th>
                <th>
                  Type
                  <a href="javascript:void(0)" tabindex="1"
                     data-trigger="focus" data-placement="top"
                     data-container="body"
                     data-content="{{ 'index.type' | translate:links }}" bs-popover>
                    <i class="fa fa-question-circle"></i>
                  </a>
                </th>

                <th>
                  Properties
                </th>
                <th>
                  Engine
                  <a href="javascript:void(0)" tabindex="1"
                     data-trigger="focus" data-placement="top"
                     data-container="body"
                     data-content="{{ 'index.engine' | translate:links }}" bs-popover>
                    <i class="fa fa-question-circle"></i>
                  </a>
                </th>
                <th>
                  Actions
                </th>

              </tr>

              </thead>
              <tbody>
              <tr ng-repeat="index in indexes | orderBy:'name'  track by $index">
                <td>
                  {{index.name}}
                </td>
                <td>
                  {{index.type}}
                </td>
                <td>
                  {{index.fields}}
                </td>
                <td>
                  {{getEngine(index)}}
                </td>
                <td>
                  <button href="javascript:void(0)" class="btn btn-default btn-xs"
                          ng-click="rebuildIndex(index.name)">
                    <i class="fa fa-refresh"></i> Rebuild
                  </button>
                  <button href="javascript:void(0)" class="btn btn-danger btn-xs"
                          ng-click="dropIndex(index)">
                    <i class="fa fa-trash-o"></i> Drop
                  </button>

                </td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>


